<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- CSS Reset -->
<link rel="stylesheet" type="text/css" href="<?=site_url('ws-modules/auth/views/administrator/css/reset.css');?>" media="screen" />
<!--  Fluid Grid System -->
<link rel="stylesheet" type="text/css" href="<?=site_url('ws-modules/auth/views/administrator/css/fluid.css');?>" media="screen" />
<!-- Login Stylesheet -->
<link rel="stylesheet" type="text/css" href="<?=site_url('ws-modules/auth/views/administrator/css/login.css');?>" media="screen" />
<!-- Required JavaScript Files -->
<script type="text/javascript" src="<?=site_url('ws-modules/auth/views/administrator/js/jquery-1.7.2.min.js');?>"></script>
<script type="text/javascript" src="<?=site_url('ws-modules/auth/views/administrator/js/jquery.placeholder.js');?>"></script>
<script type="text/javascript" src="<?php //=site_url('ws-modules/auth/views/administrator/plugins/validate/jquery.validate.min.js');?>"></script>
<!-- Core JavaScript Files -->
<script type="text/javascript" src="js/core/dandelion.login.js"></script>
<title><?=$title;?> - Wattpad</title>
</head>
<body>
<div id="da-login">
	<div id="da-login-box-wrapper">
    	<div id="da-login-top-shadow">
        </div>
    	<div id="da-login-box">
        	<div id="da-login-box-header">
            	<h1><?=$title;?></h1>
            </div>
            <div id="da-login-box-content">
				<div id="form_message">
				</div>
				<?php form_open('')?>
                	<div id="da-login-input-wrapper">
                    	<div class="da-login-input">
							<?=form_input('username','','id="da-login-username" placeholder="'.lang('email').'"')?>
                        </div>
                    	<div class="da-login-input">
	                        <?=form_input('password','','id="da-login-password" placeholder="'.lang('password').'"')?>
                        </div>
                    </div>
                    <div id="da-login-button">
						<?=form_submit('login','Login','id="da-login-submit"')?>
                    </div>
                <?php form_close()?>
            </div>
            <div id="da-login-box-footer">
				<div id="loading-img"><img src="<?=site_url('ws-modules/auth/views/administrator/images/loading.gif');?>" /></div>
            	<!--<a href="#">forgot your password?</a>-->
                <div id="da-login-tape"><strong>{elapsed_time}</strong></div>
            </div>
        </div>
    	<div id="da-login-bottom-shadow">
        </div>
    </div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$("#da-login-submit").click(function(e){
			$('#loading-img').show();
			e.preventDefault(); 
			var username=$("#da-login-username").val();
			var password=$("#da-login-password").val();
			
			$.ajax({
				type: "POST",
				url: "<?=site_url('auth/administrator/do_login')?>",
				dataType: "json",
				data: "username="+username+"&password="+password,
				cache:false,
				success: function(data){
					if(data.status == "success") {
							$(window.location).attr('href',data.redirect);
					}
					else {
							$("#form_message").html(data.message).css({'background-color' : data.bg_color}).fadeIn('slow');
					}	
					$('#loading-img').hide();		
				}
			});
		});
	});
</script>
</body>
</html>